<?php
!defined( 'IN_HDWIKI' ) && exit( 'Access Denied' );

class control extends base
{
	function control( & $get, & $post )
	{
		$this->base( $get, $post );

		$this->view->setlang( 'zh', 'front' );

		$this->sina_connect_on = $this->plugin['socialconnect']['vars']['sina_connect_on'];
		$this->qq_connect_on = $this->plugin['socialconnect']['vars']['qq_connect_on'];
		if ( $this->sina_connect_on == '0' && $this->qq_connect_on == '0' ) {
			$this->header();
		}

		$this->load( 'plugin' );
		$this->load( 'user' );
		$this->loadplugin( 'socialconnect' );
		$_ENV['socialconnect']->append_lang( $this->view, 'zh', 'socialconnect' );
	}

	function dodefault()
	{
		if ( !$_ENV["user"]->is_login() ) {
			$this->header( 'user-login' );
		}

		$this->view->assign( 'sina_connect_on', $this->sina_connect_on );
		$this->view->assign( 'qq_connect_on', $this->qq_connect_on );
		$r = $this->db->fetch_by_field( 'socialconnect', 'uid', $this->user['uid'] );
		$is_sina_binded = $r['sina_user_id']!=0?true:false;
		$is_qq_binded = $r['qq_user_name']!=''?true:false;
		$this->view->assign( 'is_sina_binded', $is_sina_binded );
		$this->view->assign( 'is_qq_binded', $is_qq_binded );
		$this->view->display( 'file://plugins/socialconnect/view/socialconnect' );
	}
}
?>
